import React, { Component } from 'react'

class Banner extends Component {
    render() { 
        //从props中接受list
        let { list } = this.props
        return (
            <div className='Banner'>
                {
                    //渲染到虚拟dom
                    list && list.length ? list.map((item,index) => {
                        return (
                            <div className='item' key={index}>
                                <img src={item.img} alt=''/>
                                <span>{item.title}</span>
                            </div>
                        )
                    }) : ''
                }
            </div>
        )
    }
}
 
export default Banner;